package net.csdra.place.component;

import net.csdra.basis.Utils;
import net.csdra.basis.service.CurrentUserInfo;
import net.csdra.basis.service.ServiceBaseInterfaceImpl;
import net.csdra.place.domain.Place;
import net.csdra.place.domain.PlaceRepository;
import net.csdra.place.component.form.CreatePlace;
import net.csdra.place.component.form.UpdatePlace;
import org.springframework.util.Assert;

/**
 * Created by msf on 2018/1/29.
 */
public class PlaceComponentImpl extends ServiceBaseInterfaceImpl<Place, CreatePlace, UpdatePlace> implements PlaceComponent {

    PlaceRepository jpaRepository;

    public PlaceComponentImpl(PlaceRepository jpaRepository, CurrentUserInfo currentUserInfo) {
        super(Place.class, jpaRepository, currentUserInfo);
        this.jpaRepository = jpaRepository;
    }

//    @Override
//    public Place create(CreatePlace createPlace) {
//        // TODO 必要断言
//        Place place = super.create(createPlace);
//        //TODO 补齐剩余属性
//        reservationPlaceRepository.save(place);
//        Place result = new Place();
//        Utils.copyProperties(place, result);
//        return result;
//    }

//    @Override
//    public Place update(UpdatePlace updatePlace) {
//        // TODO 必要断言
//        Place update = super.update(updatePlace);
//        Assert.notNull(update, "修改对象不存在");
//        //TODO 补齐剩余属性
//        reservationPlaceRepository.save(update);
//        Place result = new Place();
//        Utils.copyProperties(update, result);
//        return result;
//    }
}
